<?php
function curPageURL() {
 $url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].
    $_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].
     $_SERVER['REQUEST_URI'];
 return $url;
}

if(!isset($_SESSION)) 
{ 
    session_start();
    $_SESSION['pagina'] = curPageURL();
} 

?>